<template>
  <div>
    <van-popup v-model:show="show" round position="bottom" :style="{ height: '100%', 'border-radius': '0' }" @close="cancel">
        <van-nav-bar title="" left-arrow @click-left="cancel"/>
        <div style="margin-top: 1.2rem;">
            <sendVerificationCode type='password' v-model="password" :cardNumber="cardNumber" maskPassword="true"></sendVerificationCode>
        </div>
        <div class="bottom_btn" @click="releaseShowClick">确认还款</div>
    </van-popup>
  </div>
</template>
<script>
export default {
    name: "paymentPass",
    props: {
        modelShow: { required: true }, //外部调用对话框展示关闭
        cardNumber: '',
        instIds: '',
        code: '',
    },
    model: {
        prop: 'modelShow',
        event: 'changeShow',
    },
    data() {
        return {
            password: ''
        }
    },
    components: {  },
    mounted() {
    },
	created () {
        this.show = this.modelShow;
	},
	computed: {

	},
    methods: {
        releaseShowClick(){
            this.$toast.loading({
                duration: 0, // 持续展示 toast
                forbidClick: true,
                message: '加载中...'
            });
            this.baseService.postForm(this.__ctx + '/plugin/mobileBusiCenter/payment', {instIds: this.instIds}).then(res => {
                this.$toast.clear();
                if (res.isOk) {
                    var status = ''; //refuse失败  ''成功
                    this.$router.replace({path:'/loanPage/repaymentResults', query: {status: status}});
                } else {
                    this.$toast({
                        icon: 'warning',
                        message: res.msg
                    });
                    var status = 'refuse'; //refuse失败  ''成功
                    this.$router.replace({path:'/loanPage/repaymentResults', query: {status: status}});
                }
            }, function (status) {
                this.$toast.clear();
                if (status == !0) {
                    this.$toast({
                        icon: 'warning',
                        message: '加载失败！' + status
                    });
                }
            });
        },
        cancel(){
            this.show = false;
            this.$emit('update:modelShow',this.show)
        },
    }
  }
</script>

<style scoped lang="less">
/deep/.van-nav-bar{
  .van-nav-bar__content{
    height: 4.4rem;
    line-height: 2rem;
    .van-icon{
      color: rgb(50, 50, 51);
      font-size: 2rem;
    }
    .van-nav-bar__title{
      font-size: 1.8rem;
    }
  }
}
[class*=van-hairline]::after{
  border: 0;
}
.bottom_btn{
    width: calc(~'100% - 2.4rem');
    height: 4.4rem;
    margin: 1.8rem 1.2rem;
    background: linear-gradient(270.00deg, var(--primary-color), var(--gradient2-color));
    border-radius: 4rem;
    color: rgb(255, 255, 255);
    font-family: HarmonyOS Sans SC;
    font-size: 1.6rem;
    font-weight: 500;
    line-height: 4.4rem;
    letter-spacing: 0%;
    text-align: center;
    position: absolute;
    bottom: 0.6rem;
    left: 0;
}
</style>